//package com.syj.nodbweb.cs;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.stereotype.Service;
//import org.springframework.web.client.RestTemplate;
//
//import java.util.concurrent.CompletableFuture;
//
///**
// * @ClassName : GitHubLookupService
// * @Description :
// * @Author : 石蕴杰
// * @Date: 2020/7/2 0:45
// */
//@Service
//public class GitHubLookupService {
//
//    private static final Logger logger = LoggerFactory.getLogger(GitHubLookupService.class);
//
//    @Autowired
//    private RestTemplate restTemplate;
//
//    // 这里进行标注为异步任务，在执行此方法的时候，会单独开启线程来执行(并指定线程池的名字)
//    @Async("taskExecutor")
//    public CompletableFuture<String> findUser(String user) throws InterruptedException {
//        logger.info("Looking up " + user);
//        String url = String.format("https://api.github.com/users/%s", user);
//        String results = restTemplate.getForObject(url, String.class);
//        // Artificial delay of 3s for demonstration purposes
//        Thread.sleep(3000L);
//        return CompletableFuture.completedFuture(results);
//    }
//}